package com.apiit.webserviceclient.activities;

import com.apiit.webserviceclient.R;
import com.apiit.webserviceclient.R.layout;
import com.apiit.webserviceclient.R.menu;

import android.os.Bundle;
import android.app.Activity;
import android.app.TabActivity;
import android.content.Intent;
import android.view.Menu;
import android.widget.TabHost;

public class ReservationsTab extends TabActivity {
	
	private TabHost tabhost;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_reservations_tab);
		
		tabhost = getTabHost();
		TabHost.TabSpec spec;
		Intent intent;
		
		Intent intename = getIntent();
		String value = intename.getStringExtra("message");
		
		//Search
		intent = new Intent(this,OPACsearch.class);
		intent.putExtra("Resmessage", value);
		spec = tabhost.newTabSpec("Search").setIndicator("Search").setContent(intent);
		tabhost.addTab(spec);
		
		//Reservations
		intent = new Intent(this,LibraryReservations.class);
		intent.putExtra("Resmessage", value);
		spec = tabhost.newTabSpec("Reservations").setIndicator("Reservations").setContent(intent);
		tabhost.addTab(spec);
		
		//Fines
		intent = new Intent(this,FinesTab.class);
		intent.putExtra("Resmessage", value);
		spec = tabhost.newTabSpec("Fines").setIndicator("Fines").setContent(intent);
		tabhost.addTab(spec);
		
		//Renewals
		intent = new Intent(this,LibraryRenewals.class);
		intent.putExtra("Resmessage", value);
		spec = tabhost.newTabSpec("Renewals").setIndicator("Renewals").setContent(intent);
		tabhost.addTab(spec);

		tabhost.setCurrentTab(1);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.reservations_tab, menu);
		return true;
	}

}
